<template>
	<view>
	<view class="yqtgmBox">
		<!-- <navigator url="../gyqrPages/gyqrPages"> -->
			<view class="yqtgmBox-item" @click="checkPermissionAndNavigate(1)">
				<view class="item-imgBox">
					<u-icon name="checkmark-circle" size="50" style="margin-left: 60rpx;"></u-icon>
				</view>
				<view class="item-textBox">
					<text class="item-text">工艺确认</text>
				</view>
			</view>
		 <!-- </navigator> -->
		<navigator url="../syqrPages/syqrPages">
			<view class="yqtgmBox-item">
				<view class="item-imgBox">
					<u-icon name="integral" size="50" style="margin-left: 60rpx;"></u-icon>
				</view>
				<view class="item-textBox">
					<text class="item-text">收样确认</text>
				</view>
			</view>
		</navigator>
		<navigator url="../cjjyPages/cjjyPages">
			<view class="yqtgmBox-item">
				<view class="item-imgBox">
					<u-icon name="integral" size="50" style="margin-left: 60rpx;"></u-icon>
				</view>
				<view class="item-textBox">
					<text class="item-text">车间检验申请</text>
				</view>
			</view>
		</navigator>
		<navigator url="../dzzxPages/dzzxPages">
			<view class="yqtgmBox-item">
				<view class="item-imgBox">
					<u-icon name="integral" size="50" style="margin-left: 60rpx;"></u-icon>
				</view>
				<view class="item-textBox">
					<text class="item-text">单子中心</text>
				</view>
			</view>
		</navigator>
		<navigator url="../wddzPages/wddzPages">
			<view class="yqtgmBox-item">
				<view class="item-imgBox">
					<u-icon name="integral" size="50" style="margin-left: 60rpx;"></u-icon>
				</view>
				<view class="item-textBox">
					<text class="item-text">我的单子</text>
				</view>
			</view>
		</navigator>
			<view class="yqtgmBox-item" @click="report">
				<view class="item-imgBox">
					<u-icon name="checkmark-circle" size="50" style="margin-left: 60rpx;"></u-icon>
				</view>
				<view class="item-textBox">
					<text class="item-text">确认记录查询表</text>
				</view>
			</view>
		<navigator url="../xmqrPages/xmqrPages">
			<view class="yqtgmBox-item" >
				<view class="item-imgBox">
					<u-icon name="checkmark-circle" size="50" style="margin-left: 60rpx;"></u-icon>
				</view>
				<view class="item-textBox">
					<text class="item-text">项目确认</text>
				</view>
			</view>
		</navigator>
	   </view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				dduData:{},
				userInfo:uni.getStorageSync('userInfo'),
			}
		},
		methods: {
			async getDuser(){
				let GRP1 = {
						GRP1: [{
							PHONE: this.userInfo.PHONE,
					}]
				}
				let GRP1Json = JSON.stringify(GRP1)
				let res = await this.$api.x3.x3request("WSLISTYDR4",GRP1)
				this.dduData = JSON.parse(res.message)
			},
			async checkPermissionAndNavigate(e) {
				var isPerm=false
				await this.getDuser()
				if(this.dduData.GRP1){
					if(this.dduData.GRP1.YFC==2 
					|| this.dduData.GRP1.YHB==2
					|| this.dduData.GRP1.YJG==2
					|| this.dduData.GRP1.YRC==2
					|| this.dduData.GRP1.YXL==2
					|| this.dduData.GRP1.YLH==2){
						isPerm=true
					}
				}
				const authorizedUsers = ['吴超','李俊宗','曾晓琴','王勇'
				,'张茂','周亚','金安国','杨佳兰','钟建','伍祥','王浩龙'
				,'邹继威','罗东','徐阳','李露','周萌萌','胡文翀1','杨俊林','白德毅']; // 有权限的用户列表
				this.userInfo = uni.getStorageSync('userInfo')
				const currentUser = this.userInfo.NAME;
			    if (isPerm) {
			        // 用户有权限，执行页面跳转
					if(e==1){
						uni.navigateTo({
							url:'../gyqrPages/gyqrPages'
						});
					}
			    } else {
			        // 用户无权限，提示
			        uni.showToast({
			            title: '您没有权限访问该页面:'+currentUser,
			            icon: 'none'
			        });
			    }
			},
			// gotoIndexPage(){
			// 	wx.switchTab({
			// 		url:"../index/index"
			// 	})
			// },
			// gotoIndexPage2(){
			// 	wx.switchTab({
			// 		url:"../accountCenter/accountCenter"
			// 	})
			// }
			report(){
				this.userInfo = uni.getStorageSync('userInfo');
				window.location.href = 'http://fr.sckxjd.com:388/decision/view/report?viewlet=KXJDERP/理化检验/确认记录查询表_mobile.cpt&op=h5'+'&id='+this.userInfo.ID;
			},
		}
	}
</script>

<style>
.top{
	height: 350rpx;
	background-color: orange;
}
.yqtgmBox{
	display: flex;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 15rpx;
}
.yqtgmBox-item{
	width: 220rpx;
	height: 180rpx;
	border: 1px solid aliceblue;
	margin-top: 15rpx;
}
.item-imgBox{
height: 120rpx;
background-color: aliceblue;
}
.item-textBox{
height: 60rpx;
line-height: 60rpx;
font-size: 26rpx;
text-align: center;
}
.item-text{

}
.gcsqdBox{
	display: flex;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 15rpx;
	margin-top: 50rpx;
}
.gcsqdBox-item{
	width: 170rpx;
	height: 150rpx;
	border: 1px solid red;
}
</style>
